/*
Navicat MySQL Data Transfer

Source Server         : 本机
Source Server Version : 50515
Source Host           : 127.0.0.1:3310
Source Database       : shop

Target Server Type    : MYSQL
Target Server Version : 50515
File Encoding         : 65001

Date: 2021-10-17 14:07:21
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for customer
-- ----------------------------
DROP TABLE IF EXISTS `customer`;
CREATE TABLE `customer` (
`id`  int(11) NOT NULL AUTO_INCREMENT ,
`name`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '唯一的用于登录的名字.支持手机号.' ,
`password`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '密码.用MD5加密' ,
`address`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '收货地址' ,
`nick`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '昵称' ,
PRIMARY KEY (`id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
AUTO_INCREMENT=3

;

-- ----------------------------
-- Records of customer
-- ----------------------------
BEGIN;
INSERT INTO `customer` VALUES ('1', 'zhangsan', '123456', null, '张三'), ('2', 'lisi', '789', null, '李四');
COMMIT;

-- ----------------------------
-- Table structure for detail
-- ----------------------------
DROP TABLE IF EXISTS `detail`;
CREATE TABLE `detail` (
`id`  int(11) NOT NULL AUTO_INCREMENT ,
`porder_id`  int(11) NULL DEFAULT NULL COMMENT '来自于订单porder的id' ,
`product_id`  int(11) NULL DEFAULT NULL COMMENT '来自于商品表product的id' ,
`quantity`  int(11) NULL DEFAULT NULL ,
`price`  decimal(10,2) NULL DEFAULT NULL ,
PRIMARY KEY (`id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
AUTO_INCREMENT=11

;

-- ----------------------------
-- Records of detail
-- ----------------------------
BEGIN;
INSERT INTO `detail` VALUES ('1', '1', '1', '12', '10.00'), ('2', '1', '2', '1', '2000.00'), ('3', '1', '3', '2', '500.00'), ('4', '2', '1', '1', '19.00'), ('5', '2', '4', '2', '39.00'), ('6', '3', '1', '1', '19.00'), ('7', '3', '1', '1', '19.00'), ('8', '3', '10', '1', '9000.00'), ('9', '4', '1', '2', '19.00'), ('10', '4', '3', '2', '666.00');
COMMIT;

-- ----------------------------
-- Table structure for porder
-- ----------------------------
DROP TABLE IF EXISTS `porder`;
CREATE TABLE `porder` (
`id`  int(11) NOT NULL AUTO_INCREMENT ,
`customer_id`  int(11) NULL DEFAULT NULL ,
`date`  datetime NULL DEFAULT NULL ,
`status`  int(255) NULL DEFAULT NULL COMMENT '状态.0购物车.1提交确认但未付款.2已付款(未发货).3已发货.4已收货' ,
`out_trade_no`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '商户交易号（将传递给支付宝或微信用），包含年月日时分秒随机数顾客id' ,
`total`  decimal(10,2) NULL DEFAULT NULL COMMENT '订单总金额（虽然是一个冗余，只是为了后续编程方便）' ,
PRIMARY KEY (`id`),
UNIQUE INDEX `number` (`out_trade_no`) USING BTREE 
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
AUTO_INCREMENT=5

;

-- ----------------------------
-- Records of porder
-- ----------------------------
BEGIN;
INSERT INTO `porder` VALUES ('1', '1', '2021-09-22 15:32:22', '2', '20210924133542_9077_1', '100.00'), ('2', '1', '2021-09-24 17:13:39', '2', '20210924171441_5884_1', '97.00'), ('3', '1', '2021-10-09 20:07:13', '1', '20211009201803_1967_1', '9038.00'), ('4', '1', '2021-10-13 10:36:22', '1', '20211013103655_2168_1', '1370.00');
COMMIT;

-- ----------------------------
-- Table structure for product
-- ----------------------------
DROP TABLE IF EXISTS `product`;
CREATE TABLE `product` (
`id`  int(11) NOT NULL AUTO_INCREMENT ,
`title`  varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品对应的专业方向名' ,
`name`  varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品标题' ,
`price`  decimal(10,2) NULL DEFAULT NULL ,
`fee`  char(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '（微信接口中的那种金额，以分为单位的字符串。这里可能暂时没使用它）' ,
`status`  int(2) NULL DEFAULT 1 COMMENT '代表商品状态.0表示下架,1表示在架' ,
`claim`  char(40) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '宣称的一句话说明' ,
`description`  text CHARACTER SET utf8 COLLATE utf8_general_ci NULL ,
`img`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
PRIMARY KEY (`id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
AUTO_INCREMENT=12

;

-- ----------------------------
-- Records of product
-- ----------------------------
BEGIN;
INSERT INTO `product` VALUES ('1', null, '水杯', '19.00', null, '999', null, 'fsfdsafsdfsd', null), ('2', null, 'iphone手机', '2009.00', null, null, null, null, null), ('3', null, '大米电灯', '666.00', null, null, null, null, null), ('10', null, 'mac电脑', '9000.00', null, '1', null, null, null), ('11', null, 'U盘', '200.00', null, '1', null, null, null);
COMMIT;

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id`  int(11) NOT NULL AUTO_INCREMENT ,
`name`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '唯一的用于登录的名字.支持手机号.' ,
`password`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '密码.用MD5加密' ,
`nick`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '昵称' ,
PRIMARY KEY (`id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
AUTO_INCREMENT=3

;

-- ----------------------------
-- Records of user
-- ----------------------------
BEGIN;
INSERT INTO `user` VALUES ('1', 'xiaoming', 'E10ADC3949BA59ABBE56E057F20F883E', '小明'), ('2', 'Tom', '68053AF2923E00204C3CA7C6A3150CF7', '汤姆');
COMMIT;

-- ----------------------------
-- Auto increment value for customer
-- ----------------------------
ALTER TABLE `customer` AUTO_INCREMENT=3;

-- ----------------------------
-- Auto increment value for detail
-- ----------------------------
ALTER TABLE `detail` AUTO_INCREMENT=11;

-- ----------------------------
-- Auto increment value for porder
-- ----------------------------
ALTER TABLE `porder` AUTO_INCREMENT=5;

-- ----------------------------
-- Auto increment value for product
-- ----------------------------
ALTER TABLE `product` AUTO_INCREMENT=12;

-- ----------------------------
-- Auto increment value for user
-- ----------------------------
ALTER TABLE `user` AUTO_INCREMENT=3;
